<?php
namespace frontend\controllers;

use Yii;
use common\models\Reply;
use yii\web\Controller;

class ReplyController extends Controller
{

    public function actionAdd()
    {
        $reply = new Reply();
        $reply->comment_id = Yii::$app->request->post('comment_id');
        $reply->reply = Yii::$app->request->post('reply');
        $reply->created_at = time();
        $reply->updated_at = time();
        if ($reply->save()) {
            return $this->redirect(Yii::$app->request->referrer);
        } else {
            return "回复失败！";
        }
        
    }
}